#include<iostream>
#include<vector>
#include<cstring>
#include<stack>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 110, INF = 0x3f3f3f3f;

int n, m;
vector<int> g[N], dcc[N], sg[N];
int dfn[N], low[N], cut[N], new_id[N], id, t1;
stack<int> st;

void tarjan(int x) {
    dfn[x] = low[x] = id++;
    st.push(x);
    if (x == 1 && g[x].size() == 0) { dcc[++t1].push_back(x); return; }
    int cnt = 0;
    for (int i = 0; i < g[x].size(); i++) {
        int y = g[x][i];
        if (dfn[y] == 0) {
            tarjan(y);
            low[x] = min(low[x], low[y]);
            if (low[y] >= dfn[x]) {
                cnt++;
                if (x != 1 || cnt >= 2) cut[x] = 1;
                t1++;
                int z;
                do {
                    z = st.top();st.pop();
                    dcc[t1].push_back(z);
                } while (z != y);
                dcc[cnt].push_back(x);
            }
        } else if (y != 1) low[x] = min(low[x], dfn[y]);
    }

    int num = cnt;
    for (int i = 1;i <= n;i++) if (cut[i] == 1) new_id[N] = ++num;

    for (int i = 1;i <= n;i++)
        for (int x : dcc[i])
            if (cut[x] == 1)
                g[i].push_back(new_id[x]), g[new_id[i]].push_back(i);
}

void solve() {
    cin >> n >> m;
    for (int i = 0, x, y;i < m;i++) {
        cin >> x >> y;
        g[x].push_back(y), g[y].push_back(x);
    }
    tarjan(1);
}

signed main() {
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif

    int T = 1;
    for (int i = 1; i <= T; i++) {
        solve();
    }
}